﻿{PE.DataSource id="cone" datasource="留言_内容页" itemId="@RequestInt_id" xslt="true" /}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="UTF-8">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta content="{PE.Label id="取得META信息" siteConfig="true" metaType="keywords" /}" name="Keywords" />
<meta content="{PE.Label id="取得META信息" siteConfig="true" metaType="description" /}" name="Description"/>
<title>{PE.Field id="cone" fieldname="Title" /}-{PE.SiteConfig.SiteName /}</title>
<link href="{PE.SiteConfig.SkinPath/}default.css" rel="stylesheet" type="text/css" />
<link href="{PE.SiteConfig.SkinPath/}article.css" rel="stylesheet" type="text/css" />
<link href="{PE.SiteConfig.SkinPath/}commentary.css" rel="stylesheet" type="text/css" />
<link href="{PE.SiteConfig.SkinPath/}common.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript" src="{PE.SiteConfig.SkinPath/}js/tab.js"></script>
<script language="javascript" type="text/javascript" src="{PE.SiteConfig.ApplicationPath/}JS/Common.js"></script>
<script language="javascript" type="text/javascript" src="{PE.SiteConfig.ApplicationPath/}JS/jsPopup.js"></script></head>
<body>
{PE.Label id="商城网站顶部(内容)" /}
<div id="center_all" class="main">
  <div id="main_bg">
    <div id="main_right">
      <div id="main_right_box">
        <!-- 网站位置导航信息开始 -->
        <div class="navigation">
          您现在的位置：<a href="{PE.SiteConfig.sitepath/}">{PE.SiteConfig.SiteName /}</a>>>{PE.Label id="当前位置导航" nodeId="{PE.Field id="cone" fieldname="NodeID" /}" /} </div>
        <!-- 网站位置导航信息结束 -->
        {PE.Label id="右侧广告一" /}
        <div class="c_spacing"> </div>
		<!-- 主题内容开始 -->
		<div id="bbs_title">
		  <dl>
		主题:: 
		<span id="ctl00_CphContent_LblTitle">
		{PE.Field id="cone" fieldname="Title" /}
		</span>
                     [阅读数：<span style="color:red">{PE.Field id="cone" fieldname="Hits" /}</span>]
		  </dl>
		</div>

		<div id="bbs_center">
		  <div id="bbs_left">
		  <img src={PE.field id="cone" fieldname="GuestImages" /} alt="用户头像" />
		  <br />【{PE.field id="cone" fieldname="GuestNameType" /}】
		  <br />{PE.field id="cone" fieldname="GuestName" /}
		  </div>
		  <div id="bbs_right">
			<img src={PE.field id="cone" fieldname="GuestFace" /} alt="留言心情" />
			<br />{PE.field id="cone" fieldname="GuestContent" /}
            <br />{PE.field id="cone" fieldname="AdminReply" /}{PE.field id="cone" fieldname="AdminReplyTime" /}
		  </div>
		</div>

		<div id="bbs_bot">
		  <div id="bbs_botleft">
		  <img src={PE.SiteConfig.ApplicationPath/}Images/Comment/ip.gif alt={PE.field id="cone" fieldname="UpdateTime1" /} border="0" />

		  {PE.field id="cone" fieldname="UpdateTime" /}
		  </div>
		  <div id="bbs_botright">
			<div style="text-align: left;padding-left:5px;">
			{PE.field id="cone" fieldname="GuestHomepage" /} {PE.field id="cone" fieldname="GuestOicq" /} {PE.field id="cone" fieldname="GuestEmail" /} 
			</div>
		  </div>
		</div>
		<!-- 主题内容结束 -->
        <!-- 回复开始 -->
   <span id="commentform"></span>
        <!-- 回复结束 -->
         </div>
    </div>
    {PE.Label id="留言节点左侧" /}
  <div class="clearbox"></div>
	 </div>
</div>
{PE.Label id="商城网站底部" /}
<!-- 回复留言变量区 -->
<div id="status"></div>
<input id="username" type="hidden" value="游客" />
<input id="position" type="hidden" value="1" />
<input id="private" type="hidden" value="0" />
<input id="score" type="hidden" value="3" />
<input id="face" type="hidden" value="Images\Comment\01.gif" />
<input id="gid" type="hidden" value="@RequestInt_id" />
<input id="nid" type="hidden" value="{PE.Field id="cone" fieldname="NodeID" /}" />
<input id="tid" type="hidden" value="1" />
<input id="isguest" type="hidden" value="false" />
<!-- 回复留言变量区 -->
<script language="javascript" type="text/javascript">
function ShowTabs(ID){
    for (i=0;i<3;i++){
        if(i == ID){
            document.getElementById("TabTitle" + i).className="PK_mouseover";
            document.getElementById("Tab" + i).style.display="";
        }
        else{
            document.getElementById("TabTitle" + i).className="PK_title";
            document.getElementById("Tab" + i).style.display="none";
        }
    }
} 

function redirecturl(url, tarid)
{
    location=url.replace(/{\$pageid\/}/g,tarid);
}

function commentinit()
{
    var x = new AjaxRequest('XML','commentform');
    x.labelname = "留言回复";
        x.para = ['itemId={PE.field id="cone" fieldname="GeneralID" /}', 'nodeId={PE.field id="cone" fieldname="NodeId" /}'];
    x.currentpage = 1;
    x.post('updatelabel', '{PE.SiteConfig.ajaxsitepath/}ajax.aspx', function(s) {
        var xml = x.createXmlDom(s);
        document.getElementById("commentform").innerHTML = xml.getElementsByTagName("body")[0].firstChild.data;
        changepage(1,'回复留言列表','JS_基本风格');
        getcurrentuserinfo()
    });
}

function sendComment(e) {
    e = e || event;
    if (e.keyCode == 13) {
        var button = document.getElementById('BtnLogin');
        button.click();
    }
}

function RefreshValidateCodeImage(ValidateCodeImageControl) {
    ValidateCodeImageControl.src = ValidateCodeImageControl.src + '?code=' + RandomNum(10);
}
function RandomNum(n) {
    var rnd = '';
    for (var i = 0; i < n; i++)
        rnd += Math.floor(Math.random() * 10);
    return rnd;
}

function SetPosition(st)
{
     for (i=-1;i<2;i++){
          if(i == st){
              document.getElementById("Positon" + i).className="PK_mouseover";
          }
          else{
              document.getElementById("Positon" + i).className="PK_title";
          }
     }
     document.getElementById("position").value = st;
}

function addcomment()
{
    var strEmail = document.getElementById("email").value;
	var regEmail = /^([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
	var matchArray = strEmail.match(regEmail);
		
	
	
    if(!document.getElementById("guest").checked)
    {
        if(document.getElementById("iusername").value == '')
        {
            alert("请输入姓名");
            document.getElementById("iusername").focus();
            return false;           
        }
        else
        {
            document.getElementById("username").value = document.getElementById("iusername").value;
        }
        if(matchArray == null)
	    {
            alert("请输入正确的Email格式！");
            document.getElementById("email").focus();
            return false; 
	    }
	}
	else {
	    document.getElementById("isguest").value = "true";
	}
    if(document.getElementById("commenttitle").value == '')
    {
        alert("请输入回复主题");
        document.getElementById("commenttitle").focus();
        return false; 
    }
    if(document.getElementById("content").value == '')
    {
        alert("请输入回复内容");
        document.getElementById("content").focus();
        return false;
    }

    var txtValidCode = "";
    if (document.getElementById("comment_txtValidCode") != null) {
        if (document.getElementById("comment_txtValidCode").value == '') {
            alert("请输入验证码！");
            txtValidCode.focus();
            return false;
        }
        txtValidCode = document.getElementById("comment_txtValidCode").value;
    }
    
    var x = new AjaxRequest('XML','status');
    x.para = ['username', 'commenttitle', 'content', 'email', 'face', 'gid', 'nid', 'tid', 'private', 'position', 'score', 'isguest', 'TxtValidCode'];
    x.paratype = ['nohtml','nohtml','nohtml']
    x.post('addcomment', '{PE.SiteConfig.ajaxsitepath/}ajax.aspx', function(s) {
        var xml = x.createXmlDom(s);
        var status = xml.getElementsByTagName("status")[0].firstChild.data;
        document.getElementById("status").style.display = "none";
        switch (status) {
            case "ok":
                changepage(1, '回复留言列表', 'JS_基本风格');
                break;
            case "check":
                alert("发表留言成功，请等待管理员审核。");
                break;
            case "err":
                alert("发表留言失败！");
                break;
            case "nopurview":
                alert("此栏目已禁止发表留言！");
                break;
            case "noTourists":
                alert("此栏目已禁止游客发表留言！");
                break;
            default:
                alert("发表留言失败！");
                break;
        }
        document.getElementById("content").value = '';
        if (document.getElementById("TxtValidCode") != null) {
            document.getElementById("TxtValidCode").value = '';
            var ValidateCodeImageControl = document.getElementById("comment_vcodeLogOn");
            ValidateCodeImageControl.src = ValidateCodeImageControl.src + '?code=' + RandomNum(10);
        }
    });
}

function addpkzone(commentid,position,content)
{
    var x = new AjaxRequest('XML','status');
    x.para = ['commentid='+ commentid, 'position=' + position, 'content=' + content];
    x.post('addpkzone', '{PE.SiteConfig.ajaxsitepath/}ajax.aspx', function(s) {
        var xml = x.createXmlDom(s);
        var  status = xml.getElementsByTagName("status")[0].firstChild.data;
        document.getElementById("status").style.display = "none";
        switch (status)
        {
            case "ok":
                changepage(1,'回复留言列表','JS_基本风格');
                break;                  
            default:
                alert("辩论失败！"); 
                break;
        }
    });
}

function changepage(pagenum,sourcename,spanname)
{
    var x = new AjaxRequest('XML','pe100_' + sourcename);
    x.labelname = sourcename;
    x.currentpage = pagenum; 
	x.para = ['itemId=@RequestInt_id', 'outputQty=10', 'page=true', 'pagesize=10','currentPage='+pagenum];
	x.post('updatelabel', '{PE.SiteConfig.ajaxsitepath/}ajax.aspx', function(s) {
        var xml = x.createXmlDom(s);
        var plstr = "";
        for (var i=0; i<xml.getElementsByTagName("body")[0].childNodes.length; i++)     
        {
            plstr += xml.getElementsByTagName("body")[0].childNodes[i].nodeValue;
        }
        document.getElementById("pe100_" + sourcename).innerHTML = plstr;
        updatepage(spanname, sourcename, xml);
    });
}

function updatepage(spanname, sourcename, xml)
{
    if(parseInt(xml.getElementsByTagName("total")[0].firstChild.data) > 0)
    {
        var x = new AjaxRequest('XML','pe100_page_' + sourcename);
        x.labelname = spanname;
        x.sourcename = sourcename;
        x.total = xml.getElementsByTagName("total")[0].firstChild.data;
        x.currentpage = xml.getElementsByTagName("currentpage")[0].firstChild.data;
        x.pagesize = xml.getElementsByTagName("pagesize")[0].firstChild.data;
	    x.post('updatepage', '{PE.SiteConfig.ajaxsitepath/}ajax.aspx', function(s) {
            var xml = x.createXmlDom(s);
            if(document.getElementById("pe100_page_" + sourcename) != null)
            {
                var plstr = "";
                for (var i=0; i<xml.getElementsByTagName("body")[0].childNodes.length; i++)     
                {
                    plstr += xml.getElementsByTagName("body")[0].childNodes[i].nodeValue;
                }
                document.getElementById("pe100_page_" + sourcename).innerHTML = plstr;
            }
	});
    }
}

function setprivate()
{
    if(document.getElementById("open").checked)
    {
        document.getElementById("private").value = 0;
    }
    else
    {
        document.getElementById("private").value = 1;
    }
}

function getcurrentuserinfo()
{ 
    try{
        var x = new AjaxRequest('XML','');
	x.post('logincheck','{PE.SiteConfig.ajaxsitepath/}ajax.aspx', function(s) {
            var xml = x.createXmlDom(s);
            if(xml.getElementsByTagName("status")[0].firstChild.data == "ok")
            {
                if(document.getElementById("iusername")!=null)
                {
                    document.getElementById("iusername").value = xml.getElementsByTagName("username")[0].firstChild.data;
                    document.getElementById("email").value = xml.getElementsByTagName("email")[0].firstChild.data;
                    document.getElementById("iusername").disabled = true;
                    document.getElementById("email").disabled = true;
                }
            }
        });
      }
      catch(e){
      };
}

function setguest()
{
    if(document.getElementById("guest").checked)
    {
        document.getElementById("spanusername").style.display = 'none';
        document.getElementById("spanemail").style.display = 'none';
    }
    else
    {
        document.getElementById("spanusername").style.display = '';
        document.getElementById("spanemail").style.display = '';
    }
}

function ChangeStar(index, isfixed){
     var colStars = document.getElementById("divStars").getElementsByTagName("input");
     var i = 0;
     var k = isfixed? parseInt(document.getElementById("score").value) : index;

     for(i=0; i<colStars.length; i++){
             colStars[i].src = (i<k? "{PE.SiteConfig.applicationpath/}Images/fstar.gif" : "{PE.SiteConfig.applicationpath/}Images/estar.gif");
     }
}

function StarClick(index)
{
    document.getElementById("score").value=index;
}

function StarMouseOver(index){
    ChangeStar(index,false);
}

function StarMouseOut(){
    ChangeStar(0,true);
}

//双击鼠标滚动屏幕的代码
var currentpos,timer;
getViewPortScrollY = function()
{
    var scrollY = 0;
    if ((document.documentElement) && (document.documentElement.scrollTop))
    {
        scrollY = document.documentElement.scrollTop;
    }
    else if ((document.body) && (document.body.scrollTop))
    {
        scrollY = document.body.scrollTop;
    }
    else if (window.pageYOffset)
    {
        scrollY = window.pageYOffset;
    }
    else if (window.scrollY)
    {
        scrollY = window.scrollY;
    }
    return scrollY;
}; 
function initialize()
{
timer=setInterval ("scrollwindow ()",30);
}
function sc()
{
clearInterval(timer);
}
function scrollwindow()
{
currentpos=getViewPortScrollY();
window.scroll(0,++currentpos);
if (currentpos !=getViewPortScrollY())
sc();
}
document.onmousedown=sc
document.ondblclick=initialize

//更改字体大小
var status0='';
var curfontsize=10;
var curlineheight=18;
function fontZoomA(){
  if(curfontsize>8){
    document.getElementById('fontzoom').style.fontSize=(--curfontsize)+'pt';
	document.getElementById('fontzoom').style.lineHeight=(--curlineheight)+'pt';
  }
}
function fontZoomB(){
  if(curfontsize<64){
    document.getElementById('fontzoom').style.fontSize=(++curfontsize)+'pt';
	document.getElementById('fontzoom').style.lineHeight=(++curlineheight)+'pt';
  }
}

commentinit();
</script>

</body>
</html>
